<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}鲍鱼数据分析系统{% endblock %}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/style.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand" href="/">鲍鱼数据分析系统</a>
            <div class="navbar-collapse">
                <ul class="navbar-nav me-auto">
                    {% if 'user_id' in session %}
                    <li class="nav-item"><a class="nav-link" href="/">首页</a></li>
                    <li class="nav-item"><a class="nav-link" href="/search">查询</a></li>
                    <li class="nav-item"><a class="nav-link" href="/predict">预测</a></li>
                    <li class="nav-item"><a class="nav-link" href="/train">训练</a></li>
                    <li class="nav-item"><a class="nav-link" href="/screen">大屏</a></li>
                    {% endif %}
                </ul>
                <ul class="navbar-nav">
                    {% if 'user_id' in session %}
                    <li class="nav-item"><span class="nav-link">欢迎, {{ session['username'] }}</span></li>
                    <li class="nav-item"><a class="nav-link" href="/logout">退出</a></li>
                    {% else %}
                    <li class="nav-item"><a class="nav-link" href="/login">登录</a></li>
                    <li class="nav-item"><a class="nav-link" href="/register">注册</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                    {{ message }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
                {% endfor %}
            {% endif %}
        {% endwith %}

        {% block content %}{% endblock %}
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>